#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>

using namespace std;

class Fruit
{
public:
	Fruit(){}
	virtual void show() = 0;
};

class Apple : public Fruit
{
public:
	Apple(){}
	void show()
	{
		cout << "I am Apple" << endl;
	}
};


class Banana : public Fruit
{
public:
	Banana() {}
	void show()
	{
		cout << "I am Banana" << endl;
	}
};

class Factory
{
public:
	virtual Fruit* create() = 0;
};

class AppleFactory : public Factory
{
public:
	Fruit* create()
	{
		Fruit* fruit = new Apple();
		return fruit;
	}
};

class BananaFactory : public Factory
{
public:
	Fruit* create()
	{
		Fruit* fruit = new Banana();
		return fruit;
	}
};

int main()
{
	Factory* a = new AppleFactory();
	Fruit* aa = a->create();
	aa->show();

	Factory* b = new BananaFactory();
	Fruit* bb = b->create();
	bb->show();
	return 0;
}
